home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / pack / xfh132.lzh / XFH / src / DoDOS.asm < prev    next >
Assembly Source File  |  1993-01-07  |  2KB  |  84 lines

  1. *  DoDOS.asm - Call function from an AmigaDOS process context.
  2. *  Copyright (C) 1991, 1992, 1993 Kristian Nielsen.
  3. *
  4. *  This file is part of XFH, the compressing file system handler.
  5. *
  6. *  This program is free software; you can redistribute it and/or modify
  7. *  it under the terms of the GNU General Public License as published by
  8. *  the Free Software Foundation; either version 2 of the License, or
  9. *  (at your option) any later version.
  10. *
  11. *  This program is distributed in the hope that it will be useful,
  12. *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. *  GNU General Public License for more details.
  15. *
  16. *  You should have received a copy of the GNU General Public License
  17. *  along with this program; if not, write to the Free Software
  18. *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. *
  20.  
  21. *************************************************************************
  22. *
  23. * Project: CFS
  24. * File: DoDOS.asm
  25. *
  26. * Kludge to make a call to DeviceProc. This process executes a function
  27. * for the handler, permitting AmigaDOS calls.
  28. *
  29. *************************************************************************
  30.  
  31.     INCDIR    INCLUDE:
  32.  
  33.     INCLUDE    exec/types.i
  34.     INCLUDE    libraries/dosextens.i
  35.     INCLUDE    exec/ports.i
  36.  
  37.     SECTION    DoDeviceProc,CODE
  38.  
  39.     XDEF    _DoDOS
  40.     XDEF    _DoDOSSeg
  41.  
  42.     XREF    _LVOFindTask
  43.     XREF    _LVOWaitPort
  44.     XREF    _LVOGetMsg
  45.     XREF    _LVOForbid
  46.     XREF    _LVOReplyMsg
  47.  
  48. _DoDOSSeg
  49.     dc.l    0        ;Dummy seglist entry.
  50. _DoDOS
  51.     movea.l    4.w,a6
  52.     suba.l    a1,a1
  53.     jsr    _LVOFindTask(a6)
  54.     movea.l    d0,a2
  55.     lea    pr_MsgPort(a2),a2
  56. msgloop
  57.     movea.l    a2,a0
  58.     jsr    _LVOWaitPort(a6)
  59.     movea.l    a2,a0
  60.     jsr    _LVOGetMsg(a6)
  61.     tst.l    d0
  62.     beq.s    msgloop
  63.  
  64. * The first long word after the message structure is the address of
  65. * the function to call. The message is passed in a0.
  66.  
  67.     movea.l    d0,a2
  68.     movea.l    a2,a0
  69.     movea.l    MN_SIZE(a0),a1
  70.     jsr    (a1)
  71.  
  72. * Now reply the message, and exit.
  73.  
  74.     jsr    _LVOForbid(a6)    ;Musn't unload until we're done.
  75.     movea.l    a2,a1
  76.     jsr    _LVOReplyMsg(a6)
  77.  
  78. * Exit under the spell of the Forbid().
  79.  
  80.     rts
  81.  
  82.     END
  83.  
  84.